﻿/**
 * jQuery EasyUI 1.2.5
 * 
 * Licensed under the GPL terms To use it on other terms please contact us
 * 
 * Copyright(c) 2009-2011 stworthy [ stworthy@gmail.com ]
 * 
 */
(function($) {
	$.extend(Array.prototype, {
				indexOf : function(o) {
					for (var i = 0, _1 = this.length; i < _1; i++) {
						if (this[i] == o) {
							return i;
						}
					}
					return -1;
				},
				remove : function(o) {
					var _2 = this.indexOf(o);
					if (_2 != -1) {
						this.splice(_2, 1);
					}
					return this;
				},
				removeById : function(_3, id) {
					for (var i = 0, _4 = this.length; i < _4; i++) {
						if (this[i][_3] == id) {
							this.splice(i, 1);
							return this;
						}
					}
					return this;
				}
			});
	function _5(_6, _7) {
		var _8 = $.data(_6, "datagrid").options;
		var _9 = $.data(_6, "datagrid").panel;
		if (_7) {
			if (_7.width) {
				_8.width = _7.width;
			}
			if (_7.height) {
				_8.height = _7.height;
			}
		}
		if (_8.fit == true) {
			var p = _9.panel("panel").parent();
			_8.width = p.width();
			_8.height = p.height();
		}
		_9.panel("resize", {
					width : _8.width,
					height : _8.height
				});
	};
	function _a(_b) {
		var _c = $.data(_b, "datagrid").options;
		var _d = $.data(_b, "datagrid").panel;
		var _e = _d.width();
		var _f = _d.height();
		var _10 = _d.children("div.datagrid-view");
		var _11 = _10.children("div.datagrid-view1");
		var _12 = _10.children("div.datagrid-view2");
		var _13 = _11.children("div.datagrid-header");
		var _14 = _12.children("div.datagrid-header");
		var _15 = _13.find("table");
		var _16 = _14.find("table");
		_10.width(_e);
		var _17 = _13.children("div.datagrid-header-inner").show();
		_11.width(_17.find("table").width());
		if (!_c.showHeader) {
			_17.hide();
		}
		_12.width(_e - _11.outerWidth());
		_11
				.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer")
				.width(_11.width());
		_12
				.children("div.datagrid-header,div.datagrid-body,div.datagrid-footer")
				.width(_12.width());
		var hh;
		_13.css("height", "");
		_14.css("height", "");
		_15.css("height", "");
		_16.css("height", "");
		hh = Math.max(_15.height(), _16.height());
		_15.height(hh);
		_16.height(hh);
		if ($.boxModel == true) {
			_13.height(hh - (_13.outerHeight() - _13.height()));
			_14.height(hh - (_14.outerHeight() - _14.height()));
		} else {
			_13.height(hh);
			_14.height(hh);
		}
		if (_c.height != "auto") {
			var _18 = _f
					- _12.children("div.datagrid-header").outerHeight(true)
					- _12.children("div.datagrid-footer").outerHeight(true)
					- _d.children("div.datagrid-toolbar").outerHeight(true)
					- _d.children("div.datagrid-pager").outerHeight(true);
			_11.children("div.datagrid-body").height(_18);
			_12.children("div.datagrid-body").height(_18);
		}
		_10.height(_12.height());
		_12.css("left", _11.outerWidth());
	};
	function _19(_1a) {
		var _1b = $(_1a).datagrid("getPanel");
		var _1c = _1b.children("div.datagrid-mask");
		if (_1c.length) {
			_1c.css({
						width : _1b.width(),
						height : _1b.height()
					});
			var msg = _1b.children("div.datagrid-mask-msg");
			msg.css({
						left : (_1b.width() - msg.outerWidth()) / 2,
						top : (_1b.height() - msg.outerHeight()) / 2
					});
		}
	};
	function _1d(_1e, _1f) {
		var _20 = $.data(_1e, "datagrid").data.rows;
		var _21 = $.data(_1e, "datagrid").options;
		var _22 = $.data(_1e, "datagrid").panel;
		var _23 = _22.children("div.datagrid-view");
		var _24 = _23.children("div.datagrid-view1");
		var _25 = _23.children("div.datagrid-view2");
		if (!_24.find("div.datagrid-body-inner").is(":empty")) {
			if (_1f >= 0) {
				_26(_1f);
			} else {
				for (var i = 0; i < _20.length; i++) {
					_26(i);
				}
				if (_21.showFooter) {
					var _27 = $(_1e).datagrid("getFooterRows") || [];
					var c1 = _24.children("div.datagrid-footer");
					var c2 = _25.children("div.datagrid-footer");
					for (var i = 0; i < _27.length; i++) {
						_26(i, c1, c2);
					}
					_a(_1e);
				}
			}
		}
		if (_21.height == "auto") {
			var _28 = _24.children("div.datagrid-body");
			var _29 = _25.children("div.datagrid-body");
			var _2a = 0;
			var _2b = 0;
			_29.children().each(function() {
						var c = $(this);
						if (c.is(":visible")) {
							_2a += c.outerHeight();
							if (_2b < c.outerWidth()) {
								_2b = c.outerWidth();
							}
						}
					});
			if (_2b > _29.width()) {
				_2a += 18;
			}
			_28.height(_2a);
			_29.height(_2a);
			_23.height(_25.height());
		}
		_25.children("div.datagrid-body").triggerHandler("scroll");
		function _26(_2c, c1, c2) {
			c1 = c1 || _24;
			c2 = c2 || _25;
			var tr1 = c1.find("tr[datagrid-row-index=" + _2c + "]");
			var tr2 = c2.find("tr[datagrid-row-index=" + _2c + "]");
			tr1.css("height", "");
			tr2.css("height", "");
			var _2d = Math.max(tr1.height(), tr2.height());
			tr1.css("height", _2d);
			tr2.css("height", _2d);
		};
	};
	/**
	 * 列解析
	 */
	function _2e(_2f, _30) {
		function _31(_32) {
			var _33 = [];
			$("tr", _32).each(function() {
				var _34 = [];
				$("th", this).each(function() {
							var th = $(this);
							var col = {
								title : th.html(),
								align : th.attr("align") || "left",
								sortable : th.attr("sortable") == "true" || false,
								checkbox : th.attr("checkbox") == "true" || false
							};
							if (th.attr("field")) {
								col.field = th.attr("field");
							}
							if (th.attr("formatter")) {
								col.formatter = eval(th.attr("formatter"));
							}
							if (th.attr("styler")) {
								col.styler = eval(th.attr("styler"));
							}
							if (th.attr("editor")) {
								var s = $.trim(th.attr("editor"));
								if (s.substr(0, 1) == "{") {
									col.editor = eval("(" + s + ")");
								} else {
									col.editor = s;
								}
							}
							if (th.attr("rowspan")) {
								col.rowspan = parseInt(th.attr("rowspan"));
							}
							if (th.attr("colspan")) {
								col.colspan = parseInt(th.attr("colspan"));
							}
							if (th.attr("width")) {
								col.width = parseInt(th.attr("width"));
							}
							if (th.attr("hidden")) {
								col.hidden = true;
							}
							if (th.attr("resizable")) {
								col.resizable = th.attr("resizable") == "true";
							}
							_34.push(col);
						});
				_33.push(_34);
			});
			return _33;
		};
		var _35 = $("<div class=\"datagrid-wrap\">"
				+ "<div class=\"datagrid-view\">"
				+ "<div class=\"datagrid-view1\">"
				+ "<div class=\"datagrid-header\">"
				+ "<div class=\"datagrid-header-inner\"></div>" + "</div>"
				+ "<div class=\"datagrid-body\">"
				+ "<div class=\"datagrid-body-inner\"></div>" + "</div>"
				+ "<div class=\"datagrid-footer\">"
				+ "<div class=\"datagrid-footer-inner\"></div>" + "</div>"
				+ "</div>" + "<div class=\"datagrid-view2\">"
				+ "<div class=\"datagrid-header\">"
				+ "<div class=\"datagrid-header-inner\"></div>" + "</div>"
				+ "<div class=\"datagrid-body\"></div>"
				+ "<div class=\"datagrid-footer\">"
				+ "<div class=\"datagrid-footer-inner\"></div>" + "</div>"
				+ "</div>" + "<div class=\"datagrid-resize-proxy\"></div>"
				+ "</div>" + "</div>").insertAfter(_2f);
		_35.panel({
					doSize : false
				});
		_35.panel("panel").addClass("datagrid").bind("_resize",
				function(e, _36) {
					var _37 = $.data(_2f, "datagrid").options;
					if (_37.fit == true || _36) {
						_5(_2f);
						setTimeout(function() {
									if ($.data(_2f, "datagrid")) {
										_38(_2f);
									}
								}, 0);
					}
					return false;
				});
		$(_2f).hide().appendTo(_35.children("div.datagrid-view"));
		var _39 = _31($("thead[frozen=true]", _2f));
		var _3a = _31($("thead[frozen!=true]", _2f));
		return {
			panel : _35,
			frozenColumns : _39,
			columns : _3a
		};
	};
	function _3b(_3c) {
		var _3d = {
			total : 0,
			rows : []
		};
		var _3e = _3f(_3c, true).concat(_3f(_3c, false));
		$(_3c).find("tbody tr").each(function() {
					_3d.total++;
					var col = {};
					for (var i = 0; i < _3e.length; i++) {
						col[_3e[i]] = $("td:eq(" + i + ")", this).html();
					}
					_3d.rows.push(col);
				});
		return _3d;
	};
	function _40(_41) {
		var _42 = $.data(_41, "datagrid").options;
		var _43 = $.data(_41, "datagrid").panel;
		_43.panel($.extend({}, _42, {
					doSize : false,
					onResize : function(_44, _45) {
						_19(_41);
						setTimeout(function() {
									if ($.data(_41, "datagrid")) {
										_a(_41);
										_7d(_41);
										_42.onResize.call(_43, _44, _45);
									}
								}, 0);
					},
					onExpand : function() {
						_a(_41);
						_1d(_41);
						_42.onExpand.call(_43);
					}
				}));
		var _46 = _43.children("div.datagrid-view");
		var _47 = _46.children("div.datagrid-view1");
		var _48 = _46.children("div.datagrid-view2");
		var _49 = _47.children("div.datagrid-header")
				.children("div.datagrid-header-inner");
		var _4a = _48.children("div.datagrid-header")
				.children("div.datagrid-header-inner");
		_4b(_49, _42.frozenColumns, true);
		_4b(_4a, _42.columns, false);
		_49.css("display", _42.showHeader ? "block" : "none");
		_4a.css("display", _42.showHeader ? "block" : "none");
		_47.find("div.datagrid-footer-inner").css("display",
				_42.showFooter ? "block" : "none");
		_48.find("div.datagrid-footer-inner").css("display",
				_42.showFooter ? "block" : "none");
		if (_42.toolbar) {
			if (typeof _42.toolbar == "string") {
				$(_42.toolbar).addClass("datagrid-toolbar").prependTo(_43);
				$(_42.toolbar).show();
			} else {
				$("div.datagrid-toolbar", _43).remove();
				var tb = $("<div class=\"datagrid-toolbar\"></div>")
						.prependTo(_43);
				for (var i = 0; i < _42.toolbar.length; i++) {
					var btn = _42.toolbar[i];
					if (btn == "-") {
						$("<div class=\"datagrid-btn-separator\"></div>")
								.appendTo(tb);
					} else {
						var _4c = $("<a href=\"javascript:void(0)\"></a>");
						_4c[0].onclick = eval(btn.handler || function() {
						});
						_4c.css("float", "left").appendTo(tb).linkbutton($
								.extend({}, btn, {
											plain : true
										}));
					}
				}
			}
		} else {
			$("div.datagrid-toolbar", _43).remove();
		}
		$("div.datagrid-pager", _43).remove();
		if (_42.pagination) {
			var _4d = $("<div class=\"datagrid-pager\"></div>").appendTo(_43);
			_4d.pagination({
						pageNumber : _42.pageNumber,
						pageSize : _42.pageSize,
						pageList : _42.pageList,
						onSelectPage : function(_4e, _4f) {
							_42.pageNumber = _4e;
							_42.pageSize = _4f;
							_133(_41);
						}
					});
			_42.pageSize = _4d.pagination("options").pageSize;
		}
		function _4b(_50, _51, _52) {
			if (!_51) {
				return;
			}
			$(_50).show();
			$(_50).empty();
			var t = $("<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\"><tbody></tbody></table>")
					.appendTo(_50);
			for (var i = 0; i < _51.length; i++) {
				var tr = $("<tr></tr>").appendTo($("tbody", t));
				var _53 = _51[i];
				for (var j = 0; j < _53.length; j++) {
					var col = _53[j];
					var _54 = "";
					if (col.rowspan) {
						_54 += "rowspan=\"" + col.rowspan + "\" ";
					}
					if (col.colspan) {
						_54 += "colspan=\"" + col.colspan + "\" ";
					}
					var td = $("<td " + _54 + "></td>").appendTo(tr);
					if (col.checkbox) {
						td.attr("field", col.field);
						$("<div class=\"datagrid-header-check\"></div>")
								.html("<input type=\"checkbox\"/>")
								.appendTo(td);
					} else {
						if (col.field) {
							td.attr("field", col.field);
							td
									.append("<div class=\"datagrid-cell\"><span></span><span class=\"datagrid-sort-icon\"></span></div>");
							$("span", td).html(col.title);
							$("span.datagrid-sort-icon", td).html("&nbsp;");
							var _55 = td.find("div.datagrid-cell");
							if (col.resizable == false) {
								_55.attr("resizable", "false");
							}
							col.boxWidth = $.boxModel ? (col.width - (_55
									.outerWidth() - _55.width())) : col.width;
							_55.width(col.boxWidth);
							_55.css("text-align", (col.align || "left"));
						} else {
							$("<div class=\"datagrid-cell-group\"></div>")
									.html(col.title).appendTo(td);
						}
					}
					if (col.hidden) {
						td.hide();
					}
				}
			}
			if (_52 && _42.rownumbers) {
				var td = $("<td rowspan=\""
						+ _42.frozenColumns.length
						+ "\"><div class=\"datagrid-header-rownumber\"></div></td>");
				if ($("tr", t).length == 0) {
					td.wrap("<tr></tr>").parent().appendTo($("tbody", t));
				} else {
					td.prependTo($("tr:first", t));
				}
			}
		};
	};
	function _56(_57) {
		var _58 = $.data(_57, "datagrid").panel;
		var _59 = $.data(_57, "datagrid").options;
		var _5a = $.data(_57, "datagrid").data;
		var _5b = _58.find("div.datagrid-body");
		_5b.find("tr[datagrid-row-index]").unbind(".datagrid").bind(
				"mouseenter.datagrid", function() {
					var _5c = $(this).attr("datagrid-row-index");
					_5b.find("tr[datagrid-row-index=" + _5c + "]")
							.addClass("datagrid-row-over");
				}).bind("mouseleave.datagrid", function() {
			var _5d = $(this).attr("datagrid-row-index");
			_5b.find("tr[datagrid-row-index=" + _5d + "]")
					.removeClass("datagrid-row-over");
		}).bind("click.datagrid", function() {
					var _5e = $(this).attr("datagrid-row-index");
					if (_59.singleSelect == true) {
						_68(_57);
						_69(_57, _5e);
					} else {
						if ($(this).hasClass("datagrid-row-selected")) {
							_6a(_57, _5e);
						} else {
							_69(_57, _5e);
						}
					}
					if (_59.onClickRow) {
						_59.onClickRow.call(_57, _5e, _5a.rows[_5e]);
					}
				}).bind("dblclick.datagrid", function() {
					var _5f = $(this).attr("datagrid-row-index");
					if (_59.onDblClickRow) {
						_59.onDblClickRow.call(_57, _5f, _5a.rows[_5f]);
					}
				}).bind("contextmenu.datagrid", function(e) {
					var _60 = $(this).attr("datagrid-row-index");
					if (_59.onRowContextMenu) {
						_59.onRowContextMenu.call(_57, e, _60, _5a.rows[_60]);
					}
				});
		_5b.find("td[field]").unbind(".datagrid").bind("click.datagrid",
				function() {
					var _61 = $(this).parent().attr("datagrid-row-index");
					var _62 = $(this).attr("field");
					var _63 = _5a.rows[_61][_62];
					_59.onClickCell.call(_57, _61, _62, _63);
				}).bind("dblclick.datagrid", function() {
					var _64 = $(this).parent().attr("datagrid-row-index");
					var _65 = $(this).attr("field");
					var _66 = _5a.rows[_64][_65];
					_59.onDblClickCell.call(_57, _64, _65, _66);
				});
		_5b.find("div.datagrid-cell-check input[type=checkbox]")
				.unbind(".datagrid").bind("click.datagrid", function(e) {
					var _67 = $(this).parent().parent().parent()
							.attr("datagrid-row-index");
					if (_59.singleSelect) {
						_68(_57);
						_69(_57, _67);
					} else {
						if ($(this).is(":checked")) {
							_69(_57, _67);
						} else {
							_6a(_57, _67);
						}
					}
					e.stopPropagation();
				});
	};
	function _6b(_6c) {
		var _6d = $.data(_6c, "datagrid").panel;
		var _6e = $.data(_6c, "datagrid").options;
		var _6f = _6d.find("div.datagrid-header");
		_6f.find("td:has(div.datagrid-cell)").unbind(".datagrid").bind(
				"mouseenter.datagrid", function() {
					$(this).addClass("datagrid-header-over");
				}).bind("mouseleave.datagrid", function() {
					$(this).removeClass("datagrid-header-over");
				}).bind("contextmenu.datagrid", function(e) {
					var _70 = $(this).attr("field");
					_6e.onHeaderContextMenu.call(_6c, e, _70);
				});
		_6f.find("input[type=checkbox]").unbind(".datagrid").bind(
				"click.datagrid", function() {
					if (_6e.singleSelect) {
						return false;
					}
					if ($(this).is(":checked")) {
						_c4(_6c);
					} else {
						_c2(_6c);
					}
				});
		var _71 = _6d.children("div.datagrid-view");
		var _72 = _71.children("div.datagrid-view1");
		var _73 = _71.children("div.datagrid-view2");
		_73.children("div.datagrid-body").unbind(".datagrid").bind(
				"scroll.datagrid", function() {
					_72.children("div.datagrid-body").scrollTop($(this)
							.scrollTop());
					_73.children("div.datagrid-header").scrollLeft($(this)
							.scrollLeft());
					_73.children("div.datagrid-footer").scrollLeft($(this)
							.scrollLeft());
				});
		function _74(_75, _76) {
			_75.unbind(".datagrid");
			if (!_76) {
				return;
			}
			_75.bind("click.datagrid", function(e) {
						var _77 = $(this).parent().attr("field");
						var opt = _85(_6c, _77);
						if (!opt.sortable) {
							return;
						}
						_6e.sortName = _77;
						_6e.sortOrder = "asc";
						var c = "datagrid-sort-asc";
						if ($(this).hasClass("datagrid-sort-asc")) {
							c = "datagrid-sort-desc";
							_6e.sortOrder = "desc";
						}
						_6f
								.find("div.datagrid-cell")
								.removeClass("datagrid-sort-asc datagrid-sort-desc");
						$(this).addClass(c);
						if (_6e.remoteSort) {
							_133(_6c);
						} else {
							var _78 = $.data(_6c, "datagrid").data;
							_a9(_6c, _78);
						}
						if (_6e.onSortColumn) {
							_6e.onSortColumn.call(_6c, _6e.sortName,
									_6e.sortOrder);
						}
					});
		};
		_74(_6f.find("div.datagrid-cell"), true);
		_6f.find("div.datagrid-cell").each(function() {
			$(this).resizable({
				handles : "e",
				disabled : ($(this).attr("resizable") ? $(this)
						.attr("resizable") == "false" : false),
				minWidth : 25,
				onStartResize : function(e) {
					_6f.css("cursor", "e-resize");
					_71.children("div.datagrid-resize-proxy").css({
								left : e.pageX - $(_6d).offset().left - 1,
								display : "block"
							});
					_74($(this), false);
				},
				onResize : function(e) {
					_71.children("div.datagrid-resize-proxy").css({
								display : "block",
								left : e.pageX - $(_6d).offset().left - 1
							});
					return false;
				},
				onStopResize : function(e) {
					_6f.css("cursor", "");
					var _79 = $(this).parent().attr("field");
					var col = _85(_6c, _79);
					col.width = $(this).outerWidth();
					col.boxWidth = $.boxModel == true
							? $(this).width()
							: $(this).outerWidth();
					_38(_6c, _79);
					_7d(_6c);
					setTimeout(function() {
								_74($(e.data.target), true);
							}, 0);
					var _7a = _6d.find("div.datagrid-view2");
					_7a.find("div.datagrid-header").scrollLeft(_7a
							.find("div.datagrid-body").scrollLeft());
					_71.children("div.datagrid-resize-proxy").css("display",
							"none");
					_6e.onResizeColumn.call(_6c, _79, col.width);
				}
			});
		});
		_72.children("div.datagrid-header").find("div.datagrid-cell")
				.resizable({
					onStopResize : function(e) {
						_6f.css("cursor", "");
						var _7b = $(this).parent().attr("field");
						var col = _85(_6c, _7b);
						col.width = $(this).outerWidth();
						col.boxWidth = $.boxModel == true
								? $(this).width()
								: $(this).outerWidth();
						_38(_6c, _7b);
						var _7c = _6d.find("div.datagrid-view2");
						_7c.find("div.datagrid-header").scrollLeft(_7c
								.find("div.datagrid-body").scrollLeft());
						_71.children("div.datagrid-resize-proxy").css(
								"display", "none");
						_a(_6c);
						_7d(_6c);
						setTimeout(function() {
									_74($(e.data.target), true);
								}, 0);
						_6e.onResizeColumn.call(_6c, _7b, col.width);
					}
				});
	};
	function _7d(_7e) {
		var _7f = $.data(_7e, "datagrid").options;
		if (!_7f.fitColumns) {
			return;
		}
		var _80 = $.data(_7e, "datagrid").panel;
		var _81 = _80.find("div.datagrid-view2 div.datagrid-header");
		var _82 = 0;
		var _83;
		var _84 = _3f(_7e, false);
		for (var i = 0; i < _84.length; i++) {
			var col = _85(_7e, _84[i]);
			if (!col.hidden && !col.checkbox) {
				_82 += col.width;
				_83 = col;
			}
		}
		var _86 = _81.children("div.datagrid-header-inner").show();
		var _87 = _81.width() - _81.find("table").width() - _7f.scrollbarSize;
		var _88 = _87 / _82;
		if (!_7f.showHeader) {
			_86.hide();
		}
		for (var i = 0; i < _84.length; i++) {
			var col = _85(_7e, _84[i]);
			if (!col.hidden && !col.checkbox) {
				var _89 = Math.floor(col.width * _88);
				_8a(col, _89);
				_87 -= _89;
			}
		}
		_38(_7e);
		if (_87) {
			_8a(_83, _87);
			_38(_7e, _83.field);
		}
		function _8a(col, _8b) {
			if(!col)return;
			col.width += _8b;
			col.boxWidth += _8b;
			_81.find("td[field=\"" + col.field + "\"] div.datagrid-cell")
					.width(col.boxWidth);
		};
	};
	function _38(_8c, _8d) {
		var _8e = $.data(_8c, "datagrid").panel;
		var bf = _8e.find("div.datagrid-body,div.datagrid-footer");
		if (_8d) {
			fix(_8d);
		} else {
			_8e.find("div.datagrid-header td[field]").each(function() {
						fix($(this).attr("field"));
					});
		}
		_91(_8c);
		setTimeout(function() {
					_1d(_8c);
					_9a(_8c);
				}, 0);
		function fix(_8f) {
			var col = _85(_8c, _8f);
			bf.find("td[field=\"" + _8f + "\"]").each(function() {
						var td = $(this);
						var _90 = td.attr("colspan") || 1;
						if (_90 == 1) {
							td.find("div.datagrid-cell").width(col.boxWidth);
							td.find("div.datagrid-editable").width(col.width);
						}
					});
		};
	};
	function _91(_92) {
		var _93 = $.data(_92, "datagrid").panel;
		var _94 = _93.find("div.datagrid-header");
		_93.find("div.datagrid-body td.datagrid-td-merged").each(function() {
					var td = $(this);
					var _95 = td.attr("colspan") || 1;
					var _96 = td.attr("field");
					var _97 = _94.find("td[field=\"" + _96 + "\"]");
					var _98 = _97.width();
					for (var i = 1; i < _95; i++) {
						_97 = _97.next();
						_98 += _97.outerWidth();
					}
					var _99 = td.children("div.datagrid-cell");
					if ($.boxModel == true) {
						_99.width(_98 - (_99.outerWidth() - _99.width()));
					} else {
						_99.width(_98);
					}
				});
	};
	function _9a(_9b) {
		var _9c = $.data(_9b, "datagrid").panel;
		_9c.find("div.datagrid-editable").each(function() {
					var ed = $.data(this, "datagrid.editor");
					if (ed.actions.resize) {
						ed.actions.resize(ed.target, $(this).width());
					}
				});
	};
	function _85(_9d, _9e) {
		var _9f = $.data(_9d, "datagrid").options;
		if (_9f.columns) {
			for (var i = 0; i < _9f.columns.length; i++) {
				var _a0 = _9f.columns[i];
				for (var j = 0; j < _a0.length; j++) {
					var col = _a0[j];
					if (col.field == _9e) {
						return col;
					}
				}
			}
		}
		if (_9f.frozenColumns) {
			for (var i = 0; i < _9f.frozenColumns.length; i++) {
				var _a0 = _9f.frozenColumns[i];
				for (var j = 0; j < _a0.length; j++) {
					var col = _a0[j];
					if (col.field == _9e) {
						return col;
					}
				}
			}
		}
		return null;
	};
	function _3f(_a1, _a2) {
		var _a3 = $.data(_a1, "datagrid").options;
		var _a4 = (_a2 == true) ? (_a3.frozenColumns || [[]]) : _a3.columns;
		if (!_a4 || _a4.length == 0) {
			return [];
		}
		var _a5 = [];
		function _a6(_a7) {
			var c = 0;
			var i = 0;
			while (true) {
				if (_a5[i] == undefined) {
					if (c == _a7) {
						return i;
					}
					c++;
				}
				i++;
			}
		};
		function _a8(r) {
			var ff = [];
			var c = 0;
			for (var i = 0; i < _a4[r].length; i++) {
				var col = _a4[r][i];
				if (col.field) {
					ff.push([c, col.field]);
				}
				c += parseInt(col.colspan || "1");
			}
			for (var i = 0; i < ff.length; i++) {
				ff[i][0] = _a6(ff[i][0]);
			}
			for (var i = 0; i < ff.length; i++) {
				var f = ff[i];
				_a5[f[0]] = f[1];
			}
		};
		for (var i = 0; i < _a4.length; i++) {
			_a8(i);
		}
		return _a5;
	};
	function _a9(_aa, _ab) {
		var _ac = $.data(_aa, "datagrid").options;
		var _ad = $.data(_aa, "datagrid").panel;
		var _ae = $.data(_aa, "datagrid").selectedRows;
		_ab = _ac.loadFilter.call(_aa, _ab);
		var _af = _ab.rows;
		$.data(_aa, "datagrid").data = _ab;
		if (_ab.footer) {
			$.data(_aa, "datagrid").footer = _ab.footer;
		}
		if (!_ac.remoteSort) {
			var opt = _85(_aa, _ac.sortName);
			if (opt) {
				var _b0 = opt.sorter || function(a, b) {
					return (a > b ? 1 : -1);
				};
				_ab.rows.sort(function(r1, r2) {
							return _b0(r1[_ac.sortName], r2[_ac.sortName])
									* (_ac.sortOrder == "asc" ? 1 : -1);
						});
			}
		}
		var _b1 = _ad.children("div.datagrid-view");
		var _b2 = _b1.children("div.datagrid-view1");
		var _b3 = _b1.children("div.datagrid-view2");
		if (_ac.view.onBeforeRender) {
			_ac.view.onBeforeRender.call(_ac.view, _aa, _af);
		}
		_ac.view.render.call(_ac.view, _aa, _b3.children("div.datagrid-body"),
				false);
		_ac.view.render.call(_ac.view, _aa, _b2.children("div.datagrid-body")
						.children("div.datagrid-body-inner"), true);
		if (_ac.showFooter) {
			_ac.view.renderFooter.call(_ac.view, _aa, _b3
							.find("div.datagrid-footer-inner"), false);
			_ac.view.renderFooter.call(_ac.view, _aa, _b2
							.find("div.datagrid-footer-inner"), true);
		}
		if (_ac.view.onAfterRender) {
			_ac.view.onAfterRender.call(_ac.view, _aa);
		}
		_ac.onLoadSuccess.call(_aa, _ab);
		var _b4 = _ad.children("div.datagrid-pager");
		if (_b4.length) {
			if (_b4.pagination("options").total != _ab.total) {
				_b4.pagination({
							total : _ab.total
						});
			}
		}
		_1d(_aa);
		_56(_aa);
		_b3.children("div.datagrid-body").triggerHandler("scroll");
		if (_ac.idField) {
			for (var i = 0; i < _af.length; i++) {
				if (_b5(_af[i])) {
					_de(_aa, _af[i][_ac.idField]);
				}
			}
		}
		function _b5(row) {
			for (var i = 0; i < _ae.length; i++) {
				if (_ae[i][_ac.idField] == row[_ac.idField]) {
					_ae[i] = row;
					return true;
				}
			}
			return false;
		};
	};
	function _b6(_b7, row) {
		var _b8 = $.data(_b7, "datagrid").options;
		var _b9 = $.data(_b7, "datagrid").data.rows;
		if (typeof row == "object") {
			return _b9.indexOf(row);
		} else {
			for (var i = 0; i < _b9.length; i++) {
				if (_b9[i][_b8.idField] == row) {
					return i;
				}
			}
			return -1;
		}
	};
	function _ba(_bb) {
		var _bc = $.data(_bb, "datagrid").options;
		var _bd = $.data(_bb, "datagrid").panel;
		var _be = $.data(_bb, "datagrid").data;
		if (_bc.idField) {
			return $.data(_bb, "datagrid").selectedRows;
		} else {
			var _bf = [];
			$("div.datagrid-view2 div.datagrid-body tr.datagrid-row-selected",
					_bd).each(function() {
						var _c0 = parseInt($(this).attr("datagrid-row-index"));
						_bf.push(_be.rows[_c0]);
					});
			return _bf;
		}
	};
	function _68(_c1) {
		_c2(_c1);
		var _c3 = $.data(_c1, "datagrid").selectedRows;
		_c3.splice(0, _c3.length);
	};
	function _c4(_c5) {
		var _c6 = $.data(_c5, "datagrid").options;
		var _c7 = $.data(_c5, "datagrid").panel;
		var _c8 = $.data(_c5, "datagrid").data;
		var _c9 = $.data(_c5, "datagrid").selectedRows;
		var _ca = _c8.rows;
		var _cb = _c7.find("div.datagrid-body");
		_cb.find("tr").addClass("datagrid-row-selected");
		var _cc = _cb.find("div.datagrid-cell-check input[type=checkbox]");
		$.fn.prop ? _cc.prop("checked", true) : _cc.attr("checked", true);
		for (var _cd = 0; _cd < _ca.length; _cd++) {
			if (_c6.idField) {
				(function() {
					var row = _ca[_cd];
					for (var i = 0; i < _c9.length; i++) {
						if (_c9[i][_c6.idField] == row[_c6.idField]) {
							return;
						}
					}
					_c9.push(row);
				})();
			}
		}
		_c6.onSelectAll.call(_c5, _ca);
	};
	function _c2(_ce) {
		var _cf = $.data(_ce, "datagrid").options;
		var _d0 = $.data(_ce, "datagrid").panel;
		var _d1 = $.data(_ce, "datagrid").data;
		var _d2 = $.data(_ce, "datagrid").selectedRows;
		var _d3 = _d0
				.find("div.datagrid-body div.datagrid-cell-check input[type=checkbox]");
		$.fn.prop ? _d3.prop("checked", false) : _d3.attr("checked", false);
		$("div.datagrid-body tr.datagrid-row-selected", _d0)
				.removeClass("datagrid-row-selected");
		if (_cf.idField) {
			for (var _d4 = 0; _d4 < _d1.rows.length; _d4++) {
				_d2.removeById(_cf.idField, _d1.rows[_d4][_cf.idField]);
			}
		}
		_cf.onUnselectAll.call(_ce, _d1.rows);
	};
	function _69(_d5, _d6) {
		var _d7 = $.data(_d5, "datagrid").panel;
		var _d8 = $.data(_d5, "datagrid").options;
		var _d9 = $.data(_d5, "datagrid").data;
		var _da = $.data(_d5, "datagrid").selectedRows;
		if (_d6 < 0 || _d6 >= _d9.rows.length) {
			return;
		}
		if (_d8.singleSelect == true) {
			_68(_d5);
		}
		var tr = $("div.datagrid-body tr[datagrid-row-index=" + _d6 + "]", _d7);
		if (!tr.hasClass("datagrid-row-selected")) {
			tr.addClass("datagrid-row-selected");
			var ck = $("div.datagrid-cell-check input[type=checkbox]", tr);
			$.fn.prop ? ck.prop("checked", true) : ck.attr("checked", true);
			if (_d8.idField) {
				var row = _d9.rows[_d6];
				(function() {
					for (var i = 0; i < _da.length; i++) {
						if (_da[i][_d8.idField] == row[_d8.idField]) {
							return;
						}
					}
					_da.push(row);
				})();
			}
		}
		_d8.onSelect.call(_d5, _d6, _d9.rows[_d6]);
		var _db = _d7.find("div.datagrid-view2");
		var _dc = _db.find("div.datagrid-header").outerHeight();
		var _dd = _db.find("div.datagrid-body");
		var top = tr.position().top - _dc;
		if (top <= 0) {
			_dd.scrollTop(_dd.scrollTop() + top);
		} else {
			if (top + tr.outerHeight() > _dd.height() - 18) {
				_dd.scrollTop(_dd.scrollTop() + top + tr.outerHeight()
						- _dd.height() + 18);
			}
		}
	};
	function _de(_df, _e0) {
		var _e1 = $.data(_df, "datagrid").options;
		var _e2 = $.data(_df, "datagrid").data;
		if (_e1.idField) {
			var _e3 = -1;
			for (var i = 0; i < _e2.rows.length; i++) {
				if (_e2.rows[i][_e1.idField] == _e0) {
					_e3 = i;
					break;
				}
			}
			if (_e3 >= 0) {
				_69(_df, _e3);
			}
		}
	};
	function _6a(_e4, _e5) {
		var _e6 = $.data(_e4, "datagrid").options;
		var _e7 = $.data(_e4, "datagrid").panel;
		var _e8 = $.data(_e4, "datagrid").data;
		var _e9 = $.data(_e4, "datagrid").selectedRows;
		if (_e5 < 0 || _e5 >= _e8.rows.length) {
			return;
		}
		var _ea = _e7.find("div.datagrid-body");
		var tr = $("tr[datagrid-row-index=" + _e5 + "]", _ea);
		var ck = $("tr[datagrid-row-index=" + _e5
						+ "] div.datagrid-cell-check input[type=checkbox]", _ea);
		tr.removeClass("datagrid-row-selected");
		$.fn.prop ? ck.prop("checked", false) : ck.attr("checked", false);
		var row = _e8.rows[_e5];
		if (_e6.idField) {
			_e9.removeById(_e6.idField, row[_e6.idField]);
		}
		_e6.onUnselect.call(_e4, _e5, row);
	};
	function _eb(_ec, _ed) {
		var _ee = $.data(_ec, "datagrid").options;
		var tr = _ee.editConfig.getTr(_ec, _ed);
		var row = _ee.editConfig.getRow(_ec, _ed);
		if (tr.hasClass("datagrid-row-editing")) {
			return;
		}
		if (_ee.onBeforeEdit.call(_ec, _ed, row) == false) {
			return;
		}
		tr.addClass("datagrid-row-editing");
		_ef(_ec, _ed);
		_9a(_ec);
		tr.find("div.datagrid-editable").each(function() {
					var _f0 = $(this).parent().attr("field");
					var ed = $.data(this, "datagrid.editor");
					ed.actions.setValue(ed.target, row[_f0]);
				});
		_f1(_ec, _ed);
	};
	
	/**
	 * zzy+
	 * 获取当前正在编辑的行的值
	 */
	function getCurrEdittingRow(_f3, _f4){
		var _f6 = $.data(_f3, "datagrid").options;
		
		var tr = _f6.editConfig.getTr(_f3, _f4);
		var row = _f6.editConfig.getRow(_f3, _f4);
		if (!tr.hasClass("datagrid-row-editing")) {
			return;
		};
		
		var _fa = {};
		tr.find("div.datagrid-editable").each(function() {
			var _fb = $(this).parent().attr("field");
			var ed = $.data(this, "datagrid.editor");
			var _fc = ed.actions.getValue(ed.target);
			if (row[_fb] != _fc) {
				row[_fb] = _fc;
				_fa[_fb] = _fc;
			}
		});
		
		return $.extend(row, _fa);
	}
	
	function _f2(_f3, _f4, _f5) {
		var _f6 = $.data(_f3, "datagrid").options;
		var _f7 = $.data(_f3, "datagrid").updatedRows;
		var _f8 = $.data(_f3, "datagrid").insertedRows;
		var tr = _f6.editConfig.getTr(_f3, _f4);
		var row = _f6.editConfig.getRow(_f3, _f4);
		
		if (!tr.hasClass("datagrid-row-editing")) {
			return;
		}
		if (!_f5) {
			if (!_f1(_f3, _f4)) {
				return;
			}
			var _f9 = false;
			var _fa = {};
			tr.find("div.datagrid-editable").each(function() {
						var _fb = $(this).parent().attr("field");
						var ed = $.data(this, "datagrid.editor");
						var _fc = ed.actions.getValue(ed.target);
						if (row[_fb] != _fc) {
							row[_fb] = _fc;
							_f9 = true;
							_fa[_fb] = _fc;
						}
					});
			if (_f9) {
				if (_f8.indexOf(row) == -1) {
					if (_f7.indexOf(row) == -1) {
						_f7.push(row);
					}
				}
			}
		}
		tr.removeClass("datagrid-row-editing");
		_fd(_f3, _f4);
		$(_f3).datagrid("refreshRow", _f4);
		if (!_f5) {
			_f6.onAfterEdit.call(_f3, _f4, row, _fa);
		} else {
			_f6.onCancelEdit.call(_f3, _f4, row);
		}
	};
	function _fe(_ff, _100) {
		var opts = $.data(_ff, "datagrid").options;
		var tr = opts.editConfig.getTr(_ff, _100);
		var _101 = [];
		tr.children("td").each(function() {
					var cell = $(this).find("div.datagrid-editable");
					if (cell.length) {
						var ed = $.data(cell[0], "datagrid.editor");
						_101.push(ed);
					}
				});
		return _101;
	};
	function _102(_103, _104) {
		var _105 = _fe(_103, _104.index);
		for (var i = 0; i < _105.length; i++) {
			if (_105[i].field == _104.field) {
				return _105[i];
			}
		}
		return null;
	};
	function _ef(_106, _107) {
		var opts = $.data(_106, "datagrid").options;
		var tr = opts.editConfig.getTr(_106, _107);
		tr.children("td").each(function() {
			var cell = $(this).find("div.datagrid-cell");
			var _108 = $(this).attr("field");
			var col = _85(_106, _108);
			if (col && col.editor) {
				var _109, _10a;
				if (typeof col.editor == "string") {
					_109 = col.editor;
				} else {
					_109 = col.editor.type;
					_10a = col.editor.options;
				}
				var _10b = opts.editors[_109];
				if (_10b) {
					var _10c = cell.html();
					var _10d = cell.outerWidth();
					cell.addClass("datagrid-editable");
					if ($.boxModel == true) {
						cell.width(_10d - (cell.outerWidth() - cell.width()));
					}
					cell
							.html("<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\"><tr><td></td></tr></table>");
					cell.children("table").attr("align", col.align);
					cell.children("table").bind("click dblclick contextmenu",
							function(e) {
								e.stopPropagation();
							});
					$.data(cell[0], "datagrid.editor", {
								actions : _10b,
								target : _10b.init(cell.find("td"), _10a),
								field : _108,
								type : _109,
								oldHtml : _10c
							});
				}
			}
		});
		_1d(_106, _107);
	};
	function _fd(_10e, _10f) {
		var opts = $.data(_10e, "datagrid").options;
		var tr = opts.editConfig.getTr(_10e, _10f);
		tr.children("td").each(function() {
					var cell = $(this).find("div.datagrid-editable");
					if (cell.length) {
						var ed = $.data(cell[0], "datagrid.editor");
						if (ed.actions.destroy) {
							ed.actions.destroy(ed.target);
						}
						cell.html(ed.oldHtml);
						$.removeData(cell[0], "datagrid.editor");
						var _110 = cell.outerWidth();
						cell.removeClass("datagrid-editable");
						if ($.boxModel == true) {
							cell.width(_110
									- (cell.outerWidth() - cell.width()));
						}
					}
				});
	};
	function _f1(_111, _112) {
		var tr = $.data(_111, "datagrid").options.editConfig.getTr(_111, _112);
		if (!tr.hasClass("datagrid-row-editing")) {
			return true;
		}
		var vbox = tr.find(".validatebox-text");
		vbox.validatebox("validate");
		vbox.trigger("mouseleave");
		var _113 = tr.find(".validatebox-invalid");
		return _113.length == 0;
	};
	function _114(_115, _116) {
		var _117 = $.data(_115, "datagrid").insertedRows;
		var _118 = $.data(_115, "datagrid").deletedRows;
		var _119 = $.data(_115, "datagrid").updatedRows;
		if (!_116) {
			var rows = [];
			rows = rows.concat(_117);
			rows = rows.concat(_118);
			rows = rows.concat(_119);
			return rows;
		} else {
			if (_116 == "inserted") {
				return _117;
			} else {
				if (_116 == "deleted") {
					return _118;
				} else {
					if (_116 == "updated") {
						return _119;
					}
				}
			}
		}
		return [];
	};
	function _11a(_11b, _11c) {
		var opts = $.data(_11b, "datagrid").options;
		var data = $.data(_11b, "datagrid").data;
		var _11d = $.data(_11b, "datagrid").insertedRows;
		var _11e = $.data(_11b, "datagrid").deletedRows;
		var _11f = $.data(_11b, "datagrid").selectedRows;
		$(_11b).datagrid("cancelEdit", _11c);
		var row = data.rows[_11c];
		if (_11d.indexOf(row) >= 0) {
			_11d.remove(row);
		} else {
			_11e.push(row);
		}
		_11f.removeById(opts.idField, data.rows[_11c][opts.idField]);
		opts.view.deleteRow.call(opts.view, _11b, _11c);
		if (opts.height == "auto") {
			_1d(_11b);
		}
	};
	function _120(_121, _122) {
		var view = $.data(_121, "datagrid").options.view;
		var _123 = $.data(_121, "datagrid").insertedRows;
		view.insertRow.call(view, _121, _122.index, _122.row);
		_56(_121);
		_123.push(_122.row);
	};
	function _124(_125, row) {
		var view = $.data(_125, "datagrid").options.view;
		var _126 = $.data(_125, "datagrid").insertedRows;
		view.insertRow.call(view, _125, null, row);
		_56(_125);
		_126.push(row);
	};
	function _127(_128) {
		var data = $.data(_128, "datagrid").data;
		var rows = data.rows;
		var _129 = [];
		for (var i = 0; i < rows.length; i++) {
			_129.push($.extend({}, rows[i]));
		}
		$.data(_128, "datagrid").originalRows = _129;
		$.data(_128, "datagrid").updatedRows = [];
		$.data(_128, "datagrid").insertedRows = [];
		$.data(_128, "datagrid").deletedRows = [];
	};
	function _12a(_12b) {
		var data = $.data(_12b, "datagrid").data;
		var ok = true;
		for (var i = 0, len = data.rows.length; i < len; i++) {
			if (_f1(_12b, i)) {
				_f2(_12b, i, false);
			} else {
				ok = false;
			}
		}
		if (ok) {
			_127(_12b);
		}
	};
	function _12c(_12d) {
		var opts = $.data(_12d, "datagrid").options;
		var _12e = $.data(_12d, "datagrid").originalRows;
		var _12f = $.data(_12d, "datagrid").insertedRows;
		var _130 = $.data(_12d, "datagrid").deletedRows;
		var _131 = $.data(_12d, "datagrid").selectedRows;
		var data = $.data(_12d, "datagrid").data;
		for (var i = 0; i < data.rows.length; i++) {
			_f2(_12d, i, true);
		}
		var _132 = [];
		for (var i = 0; i < _131.length; i++) {
			_132.push(_131[i][opts.idField]);
		}
		_131.splice(0, _131.length);
		data.total += _130.length - _12f.length;
		data.rows = _12e;
		_a9(_12d, data);
		for (var i = 0; i < _132.length; i++) {
			_de(_12d, _132[i]);
		}
		_127(_12d);
	};
	function _133(_134, _135) {
		var _136 = $.data(_134, "datagrid").panel;
		var opts = $.data(_134, "datagrid").options;
//		if (_135) {
//			opts.queryParams = _135;
//		}
		opts.queryParams = opts.queryParams || {};
		var param = $.isFunction(opts.queryParams) ? opts.queryParams() : opts.queryParams;
		var _137 = $.extend({}, param);
		
		if(_135){
			$.extend(_137, _135);	
		}
		
		
//		if (!opts.url) {
//			return;
//		}
//		var _137 = $.extend({}, opts.queryParams);
		// 分页信息
		if (opts.pagination) {
			//zzy+ 修改后台分页参数
			$.extend(_137, {
						start : ((opts.pageNumber-1) * opts.pageSize),
						limit : opts.pageSize
					});
			
//			$.extend(_137, {
//						page : opts.pageNumber,
//						rows : opts.pageSize
//					});
		}
		
		//排序信息
		if (opts.sortName) {
			$.extend(_137, {
						sort : opts.sortName,
						order : opts.sortOrder
					});
		}
		
		// 加载前事件
		if (opts.onBeforeLoad.call(_134, _137) == false) {
			return;
		}
		$(_134).datagrid("loading");
		// 延时加载
		setTimeout(function() { _138(); }, 0);
		function _138() {
			
			// zzy+ 统一ajax请求
			$.query(opts['list'], _137, function(data){	// 成功处理
				setTimeout(function() { $(_134).datagrid("loaded"); }, 0);
				_a9(_134, data);
				setTimeout(function() { _127(_134); }, 0);
			}, function(){	// 失败处理
				setTimeout(function() { $(_134).datagrid("loaded"); }, 0);
				if (opts.onLoadError) {
					opts.onLoadError.apply(_134, arguments);
				}
			})
			
//			$.ajax({
//						type : opts.method,
//						url : opts.url,
//						data : _137,
//						dataType : "json",
//						success : function(data) {
//							setTimeout(function() {
//										$(_134).datagrid("loaded");
//									}, 0);
//							_a9(_134, data);
//							setTimeout(function() {
//										_127(_134);
//									}, 0);
//						},
//						error : function() {
//							setTimeout(function() { $(_134).datagrid("loaded"); }, 0);
//							if (opts.onLoadError) {
//								opts.onLoadError.apply(_134, arguments);
//							}
//						}
//					});
		};
	};
	function _139(_13a, _13b) {
		var rows = $.data(_13a, "datagrid").data.rows;
		var _13c = $.data(_13a, "datagrid").panel;
		_13b.rowspan = _13b.rowspan || 1;
		_13b.colspan = _13b.colspan || 1;
		if (_13b.index < 0 || _13b.index >= rows.length) {
			return;
		}
		if (_13b.rowspan == 1 && _13b.colspan == 1) {
			return;
		}
		var _13d = rows[_13b.index][_13b.field];
		var tr = _13c.find("div.datagrid-body tr[datagrid-row-index="
				+ _13b.index + "]");
		var td = tr.find("td[field=\"" + _13b.field + "\"]");
		td.attr("rowspan", _13b.rowspan).attr("colspan", _13b.colspan);
		td.addClass("datagrid-td-merged");
		for (var i = 1; i < _13b.colspan; i++) {
			td = td.next();
			td.hide();
			rows[_13b.index][td.attr("field")] = _13d;
		}
		for (var i = 1; i < _13b.rowspan; i++) {
			tr = tr.next();
			var td = tr.find("td[field=\"" + _13b.field + "\"]").hide();
			rows[_13b.index + i][td.attr("field")] = _13d;
			for (var j = 1; j < _13b.colspan; j++) {
				td = td.next();
				td.hide();
				rows[_13b.index + i][td.attr("field")] = _13d;
			}
		}
		setTimeout(function() {
					_91(_13a);
				}, 0);
	};
	$.fn.datagrid = function(_13e, _13f) {
		if (typeof _13e == "string") {
			return $.fn.datagrid.methods[_13e](this, _13f);
		}
		_13e = _13e || {};
		
		
		// zzy+ 设置CRUD的相关url
		$.createURL(_13e);
		
		return this.each(function() {
					var _140 = $.data(this, "datagrid");
					var opts;
					if (_140) {
						opts = $.extend(_140.options, _13e);
						_140.options = opts;
					} else {
						opts = $.extend({}, $.extend({},
										$.fn.datagrid.defaults, {
											queryParams : {}
										}), $.fn.datagrid.parseOptions(this),
								_13e);
								
						$.createURL(opts);
								
						$(this).css("width", "").css("height", "");
						// 解析列
						var _141 = _2e(this, opts.rownumbers);
						if (!opts.columns) {
							opts.columns = _141.columns;
						}
						if (!opts.frozenColumns) {
							opts.frozenColumns = _141.frozenColumns;
						}
						$.data(this, "datagrid", {
									options : opts,
									panel : _141.panel,
									selectedRows : [],
									data : {
										total : 0,
										rows : []
									},
									originalRows : [],
									updatedRows : [],
									insertedRows : [],
									deletedRows : []
								});
					}
					_40(this);
					if (!_140) {
						var data = _3b(this);
						if (data.total > 0) {
							_a9(this, data);
							_127(this);
						}
					}
					_5(this);
					if ((opts.url && opts.list) && opts['autoLoad']!==false) {
						_133(this);
					}
					_6b(this);
				});
	};
	var _142 = {
		text : {
			init : function(_143, _144) {
				var _145 = $("<input type=\"text\" class=\"datagrid-editable-input\">")
						.appendTo(_143);
				return _145;
			},
			getValue : function(_146) {
				return $(_146).val();
			},
			setValue : function(_147, _148) {
				$(_147).val(_148);
			},
			resize : function(_149, _14a) {
				var _14b = $(_149);
				if ($.boxModel == true) {
					_14b.width(_14a - (_14b.outerWidth() - _14b.width()));
				} else {
					_14b.width(_14a);
				}
			}
		},
		textarea : {
			init : function(_14c, _14d) {
				var _14e = $("<textarea class=\"datagrid-editable-input\"></textarea>")
						.appendTo(_14c);
				return _14e;
			},
			getValue : function(_14f) {
				return $(_14f).val();
			},
			setValue : function(_150, _151) {
				$(_150).val(_151);
			},
			resize : function(_152, _153) {
				var _154 = $(_152);
				if ($.boxModel == true) {
					_154.width(_153 - (_154.outerWidth() - _154.width()));
				} else {
					_154.width(_153);
				}
			}
		},
		checkbox : {
			init : function(_155, _156) {
				var _157 = $("<input type=\"checkbox\">").appendTo(_155);
				_157.val(_156.on);
				_157.attr("offval", _156.off);
				return _157;
			},
			getValue : function(_158) {
				if ($(_158).is(":checked")) {
					return $(_158).val();
				} else {
					return $(_158).attr("offval");
				}
			},
			setValue : function(_159, _15a) {
				var _15b = false;
				if ($(_159).val() == _15a) {
					_15b = true;
				}
				$.fn.prop ? $(_159).prop("checked", _15b) : $(_159).attr(
						"checked", _15b);
			}
		},
		numberbox : {
			init : function(_15c, _15d) {
				var _15e = $("<input type=\"text\" class=\"datagrid-editable-input\">")
						.appendTo(_15c);
				_15e.numberbox(_15d);
				return _15e;
			},
			destroy : function(_15f) {
				$(_15f).numberbox("destroy");
			},
			getValue : function(_160) {
				return $(_160).val();
			},
			setValue : function(_161, _162) {
				$(_161).val(_162);
			},
			resize : function(_163, _164) {
				var _165 = $(_163);
				if ($.boxModel == true) {
					_165.width(_164 - (_165.outerWidth() - _165.width()));
				} else {
					_165.width(_164);
				}
			}
		},
		validatebox : {
			init : function(_166, _167) {
				var _168 = $("<input type=\"text\" class=\"datagrid-editable-input\">")
						.appendTo(_166);
				_168.validatebox(_167);
				return _168;
			},
			destroy : function(_169) {
				$(_169).validatebox("destroy");
			},
			getValue : function(_16a) {
				return $(_16a).val();
			},
			setValue : function(_16b, _16c) {
				$(_16b).val(_16c);
			},
			resize : function(_16d, _16e) {
				var _16f = $(_16d);
				if ($.boxModel == true) {
					_16f.width(_16e - (_16f.outerWidth() - _16f.width()));
				} else {
					_16f.width(_16e);
				}
			}
		},
		datebox : {
			init : function(_170, _171) {
				var _172 = $("<input type=\"text\">").appendTo(_170);
				_172.datebox(_171);
				return _172;
			},
			destroy : function(_173) {
				$(_173).datebox("destroy");
			},
			getValue : function(_174) {
				return $(_174).datebox("getValue");
			},
			setValue : function(_175, _176) {
				$(_175).datebox("setValue", _176);
			},
			resize : function(_177, _178) {
				$(_177).datebox("resize", _178);
			}
		},
		// zzy+
		datetimebox : {
			init : function(_170, _171) {
				var _172 = $("<input type=\"text\">").appendTo(_170);
				_172.datetimebox(_171);
				return _172;
			},
			destroy : function(_173) {
				$(_173).datebox("destroy");
			},
			getValue : function(_174) {
				return $(_174).datebox("getValue");
			},
			setValue : function(_175, _176) {
				$(_175).datebox("setValue", _176);
			},
			resize : function(_177, _178) {
				$(_177).datebox("resize", _178);
			}
		},
		combobox : {
			init : function(_179, _17a) {
				var _17b = $("<input type=\"text\">").appendTo(_179);
				_17b.combobox(_17a || {});
				return _17b;
			},
			destroy : function(_17c) {
				$(_17c).combobox("destroy");
			},
			getValue : function(_17d) {
				return $(_17d).combobox("getValue");
			},
			setValue : function(_17e, _17f) {
				$(_17e).combobox("setValue", _17f);
			},
			resize : function(_180, _181) {
				$(_180).combobox("resize", _181);
			}
		},
		combotree : {
			init : function(_182, _183) {
				var _184 = $("<input type=\"text\">").appendTo(_182);
				_184.combotree(_183);
				return _184;
			},
			destroy : function(_185) {
				$(_185).combotree("destroy");
			},
			getValue : function(_186) {
				return $(_186).combotree("getValue");
			},
			setValue : function(_187, _188) {
				$(_187).combotree("setValue", _188);
			},
			resize : function(_189, _18a) {
				$(_189).combotree("resize", _18a);
			}
		}
	};
	$.fn.datagrid.methods = {
		options : function(jq) {
			var _18b = $.data(jq[0], "datagrid").options;
			var _18c = $.data(jq[0], "datagrid").panel.panel("options");
			var opts = $.extend(_18b, {
						width : _18c.width,
						height : _18c.height,
						closed : _18c.closed,
						collapsed : _18c.collapsed,
						minimized : _18c.minimized,
						maximized : _18c.maximized
					});
			var _18d = jq.datagrid("getPager");
			if (_18d.length) {
				var _18e = _18d.pagination("options");
				$.extend(opts, {
							pageNumber : _18e.pageNumber,
							pageSize : _18e.pageSize
						});
			}
			return opts;
		},
		getPanel : function(jq) {
			return $.data(jq[0], "datagrid").panel;
		},
		getPager : function(jq) {
			return $.data(jq[0], "datagrid").panel.find("div.datagrid-pager");
		},
		getColumnFields : function(jq, _18f) {
			return _3f(jq[0], _18f);
		},
		getColumnOption : function(jq, _190) {
			return _85(jq[0], _190);
		},
		resize : function(jq, _191) {
			return jq.each(function() {
						_5(this, _191);
					});
		},
		load : function(jq, _192) {
			return jq.each(function() {
						var opts = $(this).datagrid("options");
						opts.pageNumber = 1;
						var _193 = $(this).datagrid("getPager");
						_193.pagination({
									pageNumber : 1
								});
						_133(this, _192);
					});
		},
		reload : function(jq, _194) {
			jq.datagrid('clearSelections');
			return jq.each(function() {
						_133(this, _194);
					});
		},
		reloadFooter : function(jq, _195) {
			return jq.each(function() {
						var opts = $.data(this, "datagrid").options;
						var view = $(this).datagrid("getPanel")
								.children("div.datagrid-view");
						var _196 = view.children("div.datagrid-view1");
						var _197 = view.children("div.datagrid-view2");
						if (_195) {
							$.data(this, "datagrid").footer = _195;
						}
						if (opts.showFooter) {
							opts.view.renderFooter.call(opts.view, this, _197
											.find("div.datagrid-footer-inner"),
									false);
							opts.view.renderFooter.call(opts.view, this, _196
											.find("div.datagrid-footer-inner"),
									true);
							if (opts.view.onAfterRender) {
								opts.view.onAfterRender.call(opts.view, this);
							}
							$(this).datagrid("fixRowHeight");
						}
					});
		},
		loading : function(jq) {
			return jq.each(function() {
				var opts = $.data(this, "datagrid").options;
				$(this).datagrid("getPager").pagination("loading");
				if (opts.loadMsg) {
					var _198 = $(this).datagrid("getPanel");
					$("<div class=\"datagrid-mask\" style=\"display:block\"></div>")
							.appendTo(_198);
					$("<div class=\"datagrid-mask-msg\" style=\"display:block\"></div>")
							.html(opts.loadMsg).appendTo(_198);
					_19(this);
				}
			});
		},
		loaded : function(jq) {
			return jq.each(function() {
						$(this).datagrid("getPager").pagination("loaded");
						var _199 = $(this).datagrid("getPanel");
						_199.children("div.datagrid-mask-msg").remove();
						_199.children("div.datagrid-mask").remove();
					});
		},
		fitColumns : function(jq) {
			return jq.each(function() {
						_7d(this);
					});
		},
		fixColumnSize : function(jq) {
			return jq.each(function() {
						_38(this);
					});
		},
		fixRowHeight : function(jq, _19a) {
			return jq.each(function() {
						_1d(this, _19a);
					});
		},
		loadData : function(jq, data) {
			return jq.each(function() {
						_a9(this, data);
						_127(this);
					});
		},
		getData : function(jq) {
			return $.data(jq[0], "datagrid").data;
		},
		getRows : function(jq) {
			return $.data(jq[0], "datagrid").data.rows;
		},
		getFooterRows : function(jq) {
			return $.data(jq[0], "datagrid").footer;
		},
		getRowIndex : function(jq, id) {
			return _b6(jq[0], id);
		},
		getSelected : function(jq) {
			var rows = _ba(jq[0]);
			return rows.length > 0 ? rows[0] : null;
		},
		getSelections : function(jq) {
			return _ba(jq[0]);
		},
		clearSelections : function(jq) {
			return jq.each(function() {
						_68(this);
					});
		},
		selectAll : function(jq) {
			return jq.each(function() {
						_c4(this);
					});
		},
		unselectAll : function(jq) {
			return jq.each(function() {
						_c2(this);
					});
		},
		selectRow : function(jq, _19b) {
			return jq.each(function() {
						_69(this, _19b);
					});
		},
		selectRecord : function(jq, id) {
			return jq.each(function() {
						_de(this, id);
					});
		},
		unselectRow : function(jq, _19c) {
			return jq.each(function() {
						_6a(this, _19c);
					});
		},
		beginEdit : function(jq, _19d) {
			return jq.each(function() {
						_eb(this, _19d);
					});
		},
		endEdit : function(jq, _19e) {
			return jq.each(function() {
						_f2(this, _19e, false);
					});
		},
		/**
		 * zzy+
		 * 获取当前正在编辑的行值
		 */
		getCurrRow: function(jq, _19e){
			var target = null;
			
			jq.each(function() { target = this; });
			
			return getCurrEdittingRow(target, _19e);
		},
		cancelEdit : function(jq, _19f) {
			return jq.each(function() {
						_f2(this, _19f, true);
					});
		},
		getEditors : function(jq, _1a0) {
			return _fe(jq[0], _1a0);
		},
		getEditor : function(jq, _1a1) {
			return _102(jq[0], _1a1);
		},
		refreshRow : function(jq, _1a2) {
			return jq.each(function() {
						var opts = $.data(this, "datagrid").options;
						opts.view.refreshRow.call(opts.view, this, _1a2);
					});
		},
		validateRow : function(jq, _1a3) {
			return _f1(jq[0], _1a3);
		},
		updateRow : function(jq, _1a4) {
			return jq.each(function() {
				var opts = $.data(this, "datagrid").options;
				
				//zzy+ 处理更新
				if(!_1a4.index || !_1a4.row){
					_1a4 = {
						index: jq.datagrid('getRowIndex', _1a4[opts['idField']]),
						row: _1a4
					};
				}
				
				opts.view.updateRow.call(opts.view, this, _1a4.index, _1a4.row);
			});
		},
		appendRow : function(jq, row) {
			return jq.each(function() {
						_124(this, row);
					});
		},
		insertRow : function(jq, _1a5) {
			return jq.each(function() {
						_120(this, _1a5);
					});
		},
		deleteRow : function(jq, _1a6) {
			if($.isObject(_1a6)){
				_1a6 = jq.datagrid('getRowIndex', _1a6)
			}
			return jq.each(function() {
						_11a(this, _1a6);
					});
		},
		getChanges : function(jq, _1a7) {
			return _114(jq[0], _1a7);
		},
		acceptChanges : function(jq) {
			return jq.each(function() {
						_12a(this);
					});
		},
		rejectChanges : function(jq) {
			return jq.each(function() {
						_12c(this);
					});
		},
		mergeCells : function(jq, _1a8) {
			return jq.each(function() {
						_139(this, _1a8);
					});
		},
		showColumn : function(jq, _1a9) {
			return jq.each(function() {
						var _1aa = $(this).datagrid("getPanel");
						_1aa.find("td[field=\"" + _1a9 + "\"]").show();
						$(this).datagrid("getColumnOption", _1a9).hidden = false;
						$(this).datagrid("fitColumns");
					});
		},
		hideColumn : function(jq, _1ab) {
			return jq.each(function() {
						var _1ac = $(this).datagrid("getPanel");
						_1ac.find("td[field=\"" + _1ab + "\"]").hide();
						$(this).datagrid("getColumnOption", _1ab).hidden = true;
						$(this).datagrid("fitColumns");
					});
		}
	};
	/**
	 * 解析配置项
	 */
	$.fn.datagrid.parseOptions = function(_1ad) {
		var t = $(_1ad);
		var cfg = $.extend({}, $.fn.panel.parseOptions(_1ad), {
			fitColumns : (t.attr("fitColumns")
					? t.attr("fitColumns") == "true"
					: undefined),
			striped : (t.attr("striped")
					? t.attr("striped") == "true"
					: undefined),
			nowrap : (t.attr("nowrap") ? t.attr("nowrap") == "true" : undefined),
			rownumbers : (t.attr("rownumbers")
					? t.attr("rownumbers") == "true"
					: undefined),
			singleSelect : (t.attr("singleSelect")
					? t.attr("singleSelect") == "true"
					: undefined),
			pagination : (t.attr("pagination")
					? t.attr("pagination") == "true"
					: undefined),
			pageSize : (t.attr("pageSize")
					? parseInt(t.attr("pageSize"))
					: undefined),
			pageList : (t.attr("pageList")
					? eval(t.attr("pageList"))
					: undefined),
			remoteSort : (t.attr("remoteSort")
					? t.attr("remoteSort") == "true"
					: undefined),
			sortName : t.attr("sortName"),
			sortOrder : t.attr("sortOrder"),
			showHeader : (t.attr("showHeader")
					? t.attr("showHeader") == "true"
					: undefined),
			showFooter : (t.attr("showFooter")
					? t.attr("showFooter") == "true"
					: undefined),
			scrollbarSize : (t.attr("scrollbarSize") ? parseInt(t
					.attr("scrollbarSize")) : undefined),
			loadMsg : (t.attr("loadMsg") != undefined
					? t.attr("loadMsg")
					: undefined),
			idField : t.attr("idField"),
			toolbar : t.attr("toolbar"),
			url : t.attr("url"),
			rowStyler : (t.attr("rowStyler")
					? eval(t.attr("rowStyler"))
					: undefined),
			autoLoad: t.attr("autoLoad")? $.decode(t.attr("autoLoad")) : null, //zzy+
			list: t.attr("list")? $.decode(t.attr("list")) : null, //zzy+
			save: t.attr("save")? $.decode(t.attr("save")) : null, //zzy+
			remove: t.attr("remove")? $.decode(t.attr("remove")) : null //zzy+
		});
		
		// 其他配置项
		if(t.attr("other")){
			cfg = $.extend(cfg, eval(t.attr("other")));
		}
		
		// 查询参数
		if(t.attr('queryParams')){
			cfg['queryParams'] = eval(t.attr("queryParams"));		
		}
		
		return cfg;
		
	};
	var _1ae = {
		render : function(_1af, _1b0, _1b1) {
			var opts = $.data(_1af, "datagrid").options;
			var rows = $.data(_1af, "datagrid").data.rows;
			var _1b2 = $(_1af).datagrid("getColumnFields", _1b1);
			if (_1b1) {
				if (!(opts.rownumbers || (opts.frozenColumns && opts.frozenColumns.length))) {
					return;
				}
			}
			var _1b3 = ["<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
			for (var i = 0; i < rows.length; i++) {
				var cls = (i % 2 && opts.striped)
						? "class=\"datagrid-row-alt\""
						: "";
				var _1b4 = opts.rowStyler ? opts.rowStyler.call(_1af, i,
						rows[i]) : "";
				var _1b5 = _1b4 ? "style=\"" + _1b4 + "\"" : "";
				_1b3.push("<tr datagrid-row-index=\"" + i + "\" " + cls + " "
						+ _1b5 + ">");
				_1b3.push(this.renderRow.call(this, _1af, _1b2, _1b1, i,
						rows[i]));
				_1b3.push("</tr>");
			}
			_1b3.push("</tbody></table>");
			$(_1b0).html(_1b3.join(""));
		},
		renderFooter : function(_1b6, _1b7, _1b8) {
			var opts = $.data(_1b6, "datagrid").options;
			var rows = $.data(_1b6, "datagrid").footer || [];
			var _1b9 = $(_1b6).datagrid("getColumnFields", _1b8);
			var _1ba = ["<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"];
			for (var i = 0; i < rows.length; i++) {
				_1ba.push("<tr datagrid-row-index=\"" + i + "\">");
				_1ba.push(this.renderRow.call(this, _1b6, _1b9, _1b8, i,
						rows[i]));
				_1ba.push("</tr>");
			}
			_1ba.push("</tbody></table>");
			$(_1b7).html(_1ba.join(""));
		},
		renderRow : function(_1bb, _1bc, _1bd, _1be, _1bf) {
			var opts = $.data(_1bb, "datagrid").options;
			var cc = [];
			if (_1bd && opts.rownumbers) {
				var _1c0 = _1be + 1;
				if (opts.pagination) {
					_1c0 += (opts.pageNumber - 1) * opts.pageSize;
				}
				cc
						.push("<td class=\"datagrid-td-rownumber\"><div class=\"datagrid-cell-rownumber\">"
								+ _1c0 + "</div></td>");
			}
			for (var i = 0; i < _1bc.length; i++) {
				var _1c1 = _1bc[i];
				var col = $(_1bb).datagrid("getColumnOption", _1c1);
				if (col) {
					var _1c2 = col.styler
							? (col.styler(_1bf[_1c1], _1bf, _1be) || "")
							: "";
					var _1c3 = col.hidden ? "style=\"display:none;" + _1c2
							+ "\"" : (_1c2 ? "style=\"" + _1c2 + "\"" : "");
					cc.push("<td field=\"" + _1c1 + "\" " + _1c3 + ">");
					var _1c3 = "width:" + (col.boxWidth) + "px;";
					_1c3 += "text-align:" + (col.align || "left") + ";";
					_1c3 += opts.nowrap == false ? "white-space:normal;" : "";
					cc.push("<div style=\"" + _1c3 + "\" ");
					if (col.checkbox) {
						cc.push("class=\"datagrid-cell-check ");
					} else {
						cc.push("class=\"datagrid-cell ");
					}
					cc.push("\">");
					if (col.checkbox) {
						cc.push("<input type=\"checkbox\"/>");
					} else {
						if (col.formatter) {
							cc.push(col.formatter(_1bf[_1c1], _1bf, _1be));
						} else {
							cc.push(_1bf[_1c1]);
						}
					}
					cc.push("</div>");
					cc.push("</td>");
				}
			}
			return cc.join("");
		},
		refreshRow : function(_1c4, _1c5) {
			var row = {};
			var _1c6 = $(_1c4).datagrid("getColumnFields", true).concat($(_1c4)
					.datagrid("getColumnFields", false));
			for (var i = 0; i < _1c6.length; i++) {
				row[_1c6[i]] = undefined;
			}
			var rows = $(_1c4).datagrid("getRows");
			$.extend(row, rows[_1c5]);
			this.updateRow.call(this, _1c4, _1c5, row);
		},
		updateRow : function(_1c7, _1c8, row) {
			var opts = $.data(_1c7, "datagrid").options;
			var _1c9 = $(_1c7).datagrid("getPanel");
			var rows = $(_1c7).datagrid("getRows");
			var tr = _1c9.find("div.datagrid-body tr[datagrid-row-index="
					+ _1c8 + "]");
			for (var _1ca in row) {
				rows[_1c8][_1ca] = row[_1ca];
				var td = tr.children("td[field=\"" + _1ca + "\"]");
				var cell = td.find("div.datagrid-cell");
				var col = $(_1c7).datagrid("getColumnOption", _1ca);
				if (col) {
					var _1cb = col.styler ? col.styler(rows[_1c8][_1ca],
							rows[_1c8], _1c8) : "";
					td.attr("style", _1cb || "");
					if (col.hidden) {
						td.hide();
					}
					if (col.formatter) {
						cell.html(col.formatter(rows[_1c8][_1ca], rows[_1c8],
								_1c8));
					} else {
						cell.html(rows[_1c8][_1ca]);
					}
				}
			}
			var _1cb = opts.rowStyler ? opts.rowStyler.call(_1c7, _1c8,
					rows[_1c8]) : "";
			tr.attr("style", _1cb || "");
			$(_1c7).datagrid("fixRowHeight", _1c8);
		},
		insertRow : function(_1cc, _1cd, row) {
			var opts = $.data(_1cc, "datagrid").options;
			var data = $.data(_1cc, "datagrid").data;
			var view = $(_1cc).datagrid("getPanel")
					.children("div.datagrid-view");
			var _1ce = view.children("div.datagrid-view1");
			var _1cf = view.children("div.datagrid-view2");
			if (_1cd == undefined || _1cd == null) {
				_1cd = data.rows.length;
			}
			if (_1cd > data.rows.length) {
				_1cd = data.rows.length;
			}
			for (var i = data.rows.length - 1; i >= _1cd; i--) {
				_1cf.children("div.datagrid-body")
						.find("tr[datagrid-row-index=" + i + "]").attr(
								"datagrid-row-index", i + 1);
				var tr = _1ce.children("div.datagrid-body")
						.find("tr[datagrid-row-index=" + i + "]").attr(
								"datagrid-row-index", i + 1);
				if (opts.rownumbers) {
					tr.find("div.datagrid-cell-rownumber").html(i + 2);
				}
			}
			var _1d0 = $(_1cc).datagrid("getColumnFields", true);
			var _1d1 = $(_1cc).datagrid("getColumnFields", false);
			var tr1 = "<tr datagrid-row-index=\"" + _1cd + "\">"
					+ this.renderRow.call(this, _1cc, _1d0, true, _1cd, row)
					+ "</tr>";
			var tr2 = "<tr datagrid-row-index=\"" + _1cd + "\">"
					+ this.renderRow.call(this, _1cc, _1d1, false, _1cd, row)
					+ "</tr>";
			if (_1cd >= data.rows.length) {
				var _1d2 = _1ce.children("div.datagrid-body")
						.children("div.datagrid-body-inner");
				var _1d3 = _1cf.children("div.datagrid-body");
				if (data.rows.length) {
					_1d2.find("tr:last[datagrid-row-index]").after(tr1);
					_1d3.find("tr:last[datagrid-row-index]").after(tr2);
				} else {
					_1d2
							.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"
									+ tr1 + "</tbody></table>");
					_1d3
							.html("<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tbody>"
									+ tr2 + "</tbody></table>");
				}
			} else {
				_1ce.children("div.datagrid-body")
						.find("tr[datagrid-row-index=" + (_1cd + 1) + "]")
						.before(tr1);
				_1cf.children("div.datagrid-body")
						.find("tr[datagrid-row-index=" + (_1cd + 1) + "]")
						.before(tr2);
			}
			data.total += 1;
			data.rows.splice(_1cd, 0, row);
			this.refreshRow.call(this, _1cc, _1cd);
		},
		deleteRow : function(_1d4, _1d5) {
			var opts = $.data(_1d4, "datagrid").options;
			var data = $.data(_1d4, "datagrid").data;
			var view = $(_1d4).datagrid("getPanel")
					.children("div.datagrid-view");
			var _1d6 = view.children("div.datagrid-view1");
			var _1d7 = view.children("div.datagrid-view2");
			_1d6.children("div.datagrid-body").find("tr[datagrid-row-index="
					+ _1d5 + "]").remove();
			_1d7.children("div.datagrid-body").find("tr[datagrid-row-index="
					+ _1d5 + "]").remove();
			for (var i = _1d5 + 1; i < data.rows.length; i++) {
				_1d7.children("div.datagrid-body")
						.find("tr[datagrid-row-index=" + i + "]").attr(
								"datagrid-row-index", i - 1);
				var tr = _1d6.children("div.datagrid-body")
						.find("tr[datagrid-row-index=" + i + "]").attr(
								"datagrid-row-index", i - 1);
				if (opts.rownumbers) {
					tr.find("div.datagrid-cell-rownumber").html(i);
				}
			}
			data.total -= 1;
			data.rows.splice(_1d5, 1);
		},
		onBeforeRender : function(_1d8, rows) {
		},
		onAfterRender : function(_1d9) {
			var opts = $.data(_1d9, "datagrid").options;
			if (opts.showFooter) {
				var _1da = $(_1d9).datagrid("getPanel")
						.find("div.datagrid-footer");
				_1da
						.find("div.datagrid-cell-rownumber,div.datagrid-cell-check")
						.css("visibility", "hidden");
			}
		}
	};
	$.fn.datagrid.defaults = $.extend({}, $.fn.panel.defaults, {
				frozenColumns : null,
				columns : null,
				fitColumns : true,
				toolbar : null,
				striped : false,
				method : "post",
				nowrap : true,
				idField : null,
				url : null,
				loadMsg : "Processing, please wait ...",
				rownumbers : false,
				singleSelect : false,
				pagination : false,
				pageNumber : 1,
				pageSize : 10,
				pageList : [10, 20, 30, 40, 50],
				queryParams : {},
				sortName : null,
				sortOrder : "asc",
				remoteSort : true,
				showHeader : true,
				showFooter : false,
				scrollbarSize : 18,
				rowStyler : function(_1db, _1dc) {
				},
				loadFilter : function(data) {
					if (typeof data.length == "number"
							&& typeof data.splice == "function") {
						return {
							total : data.length,
							rows : data
						};
					} else {
						return data;
					}
				},
				editors : _142,
				editConfig : {
					getTr : function(_1dd, _1de) {
						return $(_1dd)
								.datagrid("getPanel")
								.find("div.datagrid-body tr[datagrid-row-index="
										+ _1de + "]");
					},
					getRow : function(_1df, _1e0) {
						return $.data(_1df, "datagrid").data.rows[_1e0];
					}
				},
				view : _1ae,
				onBeforeLoad : function(_1e1) {
				},
				onLoadSuccess : function() {
				},
				onLoadError : function() {
				},
				onClickRow : function(_1e2, _1e3) {
				},
				onDblClickRow : function(_1e4, _1e5) {
				},
				onClickCell : function(_1e6, _1e7, _1e8) {
				},
				onDblClickCell : function(_1e9, _1ea, _1eb) {
				},
				onSortColumn : function(sort, _1ec) {
				},
				onResizeColumn : function(_1ed, _1ee) {
				},
				onSelect : function(_1ef, _1f0) {
				},
				onUnselect : function(_1f1, _1f2) {
				},
				onSelectAll : function(rows) {
				},
				onUnselectAll : function(rows) {
				},
				onBeforeEdit : function(_1f3, _1f4) {
				},
				onAfterEdit : function(_1f5, _1f6, _1f7) {
				},
				onCancelEdit : function(_1f8, _1f9) {
				},
				onHeaderContextMenu : function(e, _1fa) {
				},
				onRowContextMenu : function(e, _1fb, _1fc) {
				}
			});
})(jQuery);


$.extend($.fn.datagrid.methods, {
	/**
	 * 添加记录
	 * @param {} jq jq对象，在调用时看不见
	 * @param {} ops 操作参数，共分3种情况：
	 * 						第一种：为空，则添加一行默认空行
	 * 						第二种: json对象，则添加一行指定记录
	 * 						第三种：json数组，则添加多行指定记录
	 * 						第四种：如：{
	 * 								  rows: [{},{}], //json数组
	 * 								  isEdit: false //不需要编辑
	 * 								  callFun: function(target, rows){}
	 * 								}
	 */
	'add': function(jq, ops){
		// 如果当前已经有文件正在编辑，则不可用
		if(jq.datagrid('getEdittingId') != null){
			$.msg.show({
				title: '提示',
				msg:'当前有行正在编辑，请保存正在编辑的行后进行其他操作!'
			});
			return;
		}
		
		var target = null;
		jq.each(function(){target = this;});
		
		// 获取idField
		var idField = $.data(target, 'datagrid')['options']['idField'];
		
		// 如果为空，则默认添加
		if(!ops){
			var row = {};
			ops = {
				rows: [{}]
			};
		}else if($.isArray(ops)){ // 如果是json数组
			ops = {
				rows: ops
			};			
		}else if(!(ops['rows'] && String(ops['isEdit']))){// 如果是json
			ops = {
				rows: [ops]
			};
		}
		
		ops = $.extend({
			rows: [],
			isEdit: true,
			callFun: function(){}
		}, ops);
		
		
		for (var index = 0; index < ops.rows.length; index++) {
			var row = ops.rows[index];
			// 设置逻辑主键
			if( !ops.rows[index][idField] ){
				ops.rows[index][idField] = $.uuidVal();
			}
		}
		
		// 添加节点
		jq.datagrid('appendRow', ops['rows']);
		
		var rowIndex = jq.datagrid('getRowIndex', ops['rows'][idField]);
		
		if(ops['isEdit']){
			// 清除选中行
			jq.datagrid('unselectAll');
			
			// 选中当前添加的记录
			jq.datagrid('selectRow', rowIndex);
			
			$.data(target, 'datagrid')['currentEdittingOldRow'] = ops['rows'][0];
			$.data(target, 'datagrid')['currentEdittingRowIndex'] = rowIndex;
			
			// 开始编辑
			jq.datagrid('beginEdit',rowIndex);
		}
	
		// 执行回调函数
		ops['callFun'](target, ops['rows']);
	},
	/**
	 * 编辑
	 * @param jq jq对象，在调用时看不见
	 */
	'edit': function(jq){
		// 如果当前已经有文件正在编辑，则不可用
		if(jq.datagrid('getEdittingId') != null){
			$.msg.show({
				title: '提示',
				msg:'正在编辑，请保存正在编辑的行后进行其他操作!'
			});
			return false;
		}
		
		var target = null;
		jq.each(function(){target = this});
		
		var row = jq.datagrid('getSelected');
		// 获取idField
		var idField = $.data(target, 'datagrid')['options']['idField'];
		
		if (row){
			$.data(target, 'datagrid')['currentEdittingOldRow'] = row;
			$.data(target, 'datagrid')['currentEdittingRowIndex'] = jq.datagrid('getRowIndex', row);
			jq.datagrid('beginEdit', $.data(target, 'datagrid')['currentEdittingRowIndex']);
		}
	},
	'save': function(jq){
		var target = null;
		jq.each(function(){target = this;});
		
		var id = jq.datagrid('getEdittingId');
		if(id == null){
			$.msg.show({
				title: '提示',
				msg:'没有需要保存的记录!'
			});
			return false;
		}
		
		var row = jq.datagrid('getCurrRow', $.data(target, 'datagrid')['currentEdittingRowIndex']);
		
		$.exec($.data(target, 'datagrid')['options']['save'], row[0], function(data){
			$.msg.say("保存成功!");
			// 停止编辑
			jq.datagrid('endEdit', id);
			// 更新界面行记录
			jq.datagrid('updateRow', data);
			
			$.data(target, 'datagrid')['currentEdittingOldRow'] = null;
			$.data(target, 'datagrid')['currentEdittingRowIndex'] = null;
		});
		
	},
	'delete': function(jq){
		
		var target = null;
		jq.each(function(){target = this;});
		
		// 获取选中的节点
		var node = jq.datagrid('getSelected');
		
		if(node == null){
			$.msg.say("没有选中要删除的记录，请确认！");
			return;
		}
		
		// 获取idField
		var idField = $.data(target, 'datagrid')['options']['idField'];
		
		$.msg.confirm('询问', '是否删除当前选中记录？', function(r){
			if (r){
				$.exec($.data(target, 'datagrid')['options']['remove'], node, function(data){
					$.msg.say("删除成功!");
					$.data(target, 'datagrid')['currentEdittingOldRow'] = null;
					$.data(target, 'datagrid')['currentEdittingRowIndex'] = null;
					jq.datagrid("remove", data[idField]);
				});				
			}
		});

		
	},
	/**
	 * 获取正在编辑的行节点
	 * @param jq jq对象，在调用时看不见
	 */
	'getEdittingId': function(jq){
		var target = null;
		jq.each(function(){target = this;});
		
		// 获取idField
		var idField = $.data(target, 'datagrid')['options']['idField'];
		
		return $.data(target, 'datagrid')['currentEdittingOldRow'] 
					? $.data(target, 'datagrid')['currentEdittingOldRow'][idField] : null;	
	}
});